﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EntityModel;
using Common;

namespace Services
{
    public class MemberService
    {
        #region***属性数据***

        ShopDbEntities bdContext = DbContextHelper.GetCurrentDbContext();


        #endregion

        #region 获取所有会员

        /// <summary>
        /// 获取所有文章分类
        /// </summary>
        /// <returns></returns>
        ///  PagedList<Category>
        ///  
        public IQueryable<Member> GetAllList()
        {
            return bdContext.Members.OrderByDescending(m => m.Id);
        }

        #endregion



        #region 新增数据

        public void Create(Member model)
        {
            bdContext.Members.AddObject(model);
            bdContext.SaveChanges();
        }
        #endregion 

        #region 注册信息
        public void Register(string email, string password)
        {

            Member m = new Member();
            m.Email = email;
            m.PassWord = password;
            bdContext.Members.AddObject(m);
            bdContext.SaveChanges();
        }
        #endregion
    }
}
